package com.frxuexi.park2212.patrol

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.PointBeanItem
import com.frxuexi.park2212.R
import com.frxuexi.park2212.databinding.ItemPointBinding

class PointAdapter:BaseQuickAdapter<PointBeanItem,BaseViewHolder>(R.layout.item_point) {
    lateinit var binding:ItemPointBinding
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemPointBinding>(viewHolder.itemView)

    }
    override fun convert(helper: BaseViewHolder, item: PointBeanItem) {
        binding=DataBindingUtil.getBinding<ItemPointBinding>(helper.itemView)!!
        binding.bean=item

        binding.patrolType.apply {
            if(item.patrolType=="保洁巡检"){
                setBackgroundResource(R.drawable.shape_solid_blue)
            }else if(item.patrolType=="安防巡检"){
                setBackgroundResource(R.drawable.shape_solid_darkorange)
            }else{
                setBackgroundResource(R.drawable.shape_solid_darkgreen)
            }
        }

    }
}